package com.seek.eduservice.controller.front;

import com.seek.commonutils.ResponseResult;
import com.seek.eduservice.entity.subject.Chapter;
import com.seek.eduservice.service.EduChapterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: wml
 * @since: 2022/3/23 23:17
 */
@RestController
@RequestMapping("/eduservice/chapter")
public class ChapterController {

    @Autowired
    private EduChapterService eduChapterService;

    // 课程大纲列表，根据课程 id 进行查询
    @GetMapping("getChapterAndVideo/{courseId}")
    public ResponseResult getChapterAndVideo(@PathVariable String courseId) {
        List<Chapter> list = eduChapterService.getChapterAndVideoByCourseId(courseId);
        return ResponseResult.ok().data("chapterAndVideoList", list);
    }
}
